﻿//************************************************************************
//Developed by Rudolf Henning 2002/2003 (VB.Net) 2004 (C#)
//Source code:
//  The source code may be freely modified or used but this credit section may not be removed 
//  The original author must be notified of any modifications plus a copy of 
//  the changed source code
//Contact info: mailto://Rudolf@Hen.co.za 
//
//Changed by Guo Ming Li 2009/2010 (Contact info: mailto://gming.li@gmail.com)
//************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using System.Windows.Forms;
using System.Net;

namespace GML.BizTalk.OperationManager.Library
{
    public static class NetTools
    {
        public static bool IsValidMachineName(string machineName)
        {
            try
            {
                if (Dns.GetHostAddresses(machineName).Length > 0)
                {
                    return true;
                }
                else
                {
                    //MessageBox.Show("The computer named '" + machineName + "' does not exist or cannot be accessed!",
                    //    "Adding", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (System.Net.Sockets.SocketException)
            {
                //MessageBox.Show("The computer named '" + machineName + "' does not exist or cannot be accessed!",
                //        "Adding", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            return false;
        }
    }
}
